$(function () {
    $('#registerForm').submit(function (ev) {
        ev.preventDefault();
        var data = $(this).serialize();
        console.log(data)
        var ps1 = $('input[name=password1]').val();
        var ps2 = $('input[name=password2]').val();
        if (ps1 == ps2) {
            $.post('/api/register', data, function (res, statusText, xhr) {
                if (statusText == 'success') {
                    if (res.code == 'success') {
                        $.popup(res.content, function () {
                            $('.modal-login').css('display','block');
                            $('.modal-register').css('display','none');
                        })
                    } else {
                        $.popup(res.content);
                    }
                }
            })
        }else{
            $.popup('对不起，两次输入密码不一致')
        }
    })
})